﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Windows.Resources;
using System.Windows.Media.Imaging;
using BaicaiTianqi.Model;

namespace BaicaiTianqi.View
{
    public partial class BackTileImage : UserControl
    {
        public BackTileImage()
        {
            InitializeComponent();
        }

        public void LoadInfo()
        {
            Weatherinfo info = AppSettingsHelper.GetValueOrDefault("WeatherInfo", new Weatherinfo());

            top1.Text = String.Format(info.temp2);
            image1.Source = new BitmapImage(new Uri(IconList.getIconUri(Int32.Parse(info.img2)),
                UriKind.RelativeOrAbsolute));

            top2.Text = String.Format(info.temp3);
            image2.Source = new BitmapImage(new Uri(IconList.getIconUri(Int32.Parse(info.img3)),
                UriKind.RelativeOrAbsolute));

            top3.Text = String.Format(info.temp4);
            image3.Source = new BitmapImage(new Uri(IconList.getIconUri(Int32.Parse(info.img4)),
                UriKind.RelativeOrAbsolute));
        }
    }
}
